<template>
    <div class="qx-container p-all-10">
        <tabs :target-list="targetList"></tabs>
		<member-info v-if="tabCurrentIndex == 1" @setNewMerchant="setNewMerchant" ></member-info>
		<member-level v-if="tabCurrentIndex == 2"></member-level>
    </div>
</template>
<script>
	import {
		mapMutations,
		mapGetters
	} from 'vuex'
	import {
			getToken
	} from '@/utils/auth'
    import tabs from '@/components/tabs/tabs.vue'
	import memberInfo from './components/memberInfo.vue'
	import memberLevel from './components/memberLevel.vue'
	import { secondDirectory, tabList } from '@/utils/config.js'
	import {
		SUCCESS_REQUEST_STATUS
	} from '@/utils/config.js'
    export default {
		data() {
			return {
				targetList: {},
				merchantId: '',
				
			}
		},
		mounted() {
			
			let val = secondDirectory['member'].list
			!val[0].show && val[1].show ? this.setTabCurrentIndex(2): ''
		},
		
		methods: {
			setNewMerchant(item = null ){
				if(item) {
					this.merchantId = item.merchantId
					
				}else{
					this.merchantId = ''
				}
				this.targetList = {name: '2', title: '新增商家'}
			},
			saveMerchantInfo() {
				this.setTabCurrentIndex(1)
			},
			
			...mapMutations({
				setTabCurrentIndex: 'SET_TAB_CURRENT_INDEX'
			}),
			
		},
        components: {
            tabs,
			memberInfo,
			memberLevel
        },
		computed: {
			...mapGetters([
				'tabCurrentIndex',
				'setMerchantInfo'
			])
		}
		
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
    .qx-container {
        display: flex;
        flex: 1;
		height: 100%;
		box-sizing: border-box;
        flex-direction: column;
    }
</style>
